<?php
include ('tuaninc.php');

$site_gather_auto_time = SITE_GATHER_AUTO_TIME * 3600;

if (time() - $lasttime > $site_gather_auto_time) {
	$sql = 'select id from '.$duoduo->BIAOTOU.'mall where api_url is not NULL  and api_url<>"" and catid=' . TUANCID;
	$query = $duoduo->query($sql);
	while ($row = $duoduo->fetch_array($query)) {
		$id_arr[] = $row['id'];
	}
	$mallid = implode(",", $id_arr);
	$key = $duoduo->passport_encrypt('1', DDKEY);
	$duoduo->get_post('http://'.URL.'/comm/collect.php?auto=1&key=' . $key . '&mallid='.$mallid);
	$field_arr = array (
	'val' => time());
	$duoduo->update_sql('setting', $field_arr, "var='lasttime'", 0, 0);
}else{
	if(GOODS_DEL_AUTO==1){
	    $time=time();
	    $sql="delete from ".$duoduo->BIAOTOU."tuan_goods where endTime<'$time'";
	    $duoduo->query($sql);
	}
}
?>